* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  height: 100vh;
  overflow: hidden;
}

body[data-theme="vs-dark"],
body[data-theme="hc-black"] {
  color: #eee;
  background-color: #1e1e1e;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  height: 60px;
}

body[data-theme="vs-dark"] header,
body[data-theme="hc-black"] header {
  background-color: #252526;
  border-bottom-color: #333;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #4caf50;
}

.controls {
  display: flex;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  background-color: #fff;
  color: #333;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

body[data-theme="vs-dark"] .btn,
body[data-theme="hc-black"] .btn {
  background-color: #333;
  color: #eee;
  border-color: #555;
}

.btn:hover {
  background-color: #f5f5f5;
}

body[data-theme="vs-dark"] .btn:hover,
body[data-theme="hc-black"] .btn:hover {
  background-color: #444;
}

.btn.primary {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
}

.btn.primary:hover {
  background-color: #45a049;
}

main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 选项卡样式 */
.tabs {
  display: flex;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
  padding: 0 0.5rem;
}

body[data-theme="vs-dark"] .tabs,
body[data-theme="hc-black"] .tabs {
  background-color: #252526;
  border-bottom-color: #333;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-bottom: none;
  background-color: #eee;
  color: #333;
  cursor: pointer;
  margin-right: 0.25rem;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  position: relative;
  top: 1px;
}

body[data-theme="vs-dark"] .tab-btn,
body[data-theme="hc-black"] .tab-btn {
  background-color: #2d2d2d;
  color: #ccc;
  border-color: #333;
}

.tab-btn.active {
  background-color: #fff;
  border-bottom-color: #fff;
  color: #4caf50;
  font-weight: bold;
}

body[data-theme="vs-dark"] .tab-btn.active,
body[data-theme="hc-black"] .tab-btn.active {
  background-color: #1e1e1e;
  border-bottom-color: #1e1e1e;
  color: #4caf50;
}

.editor-pane {
  display: none;
  height: calc(100% - 41px);
}

.editor-pane.active {
  display: block;
}

/* Layout styles */
main.horizontal {
  flex-direction: row;
}

main.vertical {
  flex-direction: column;
}

main.preview-right {
  flex-direction: row;
}

main.preview-bottom {
  flex-direction: column;
}

.panel {
  overflow: hidden;
  position: relative;
}

#editor-container {
  height: 100%;
}

#preview-container {
  height: 100%;
  background-color: #fff;
}

body[data-theme="vs-dark"] #preview-container,
body[data-theme="hc-black"] #preview-container {
  background-color: #1e1e1e;
}

#preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background-color: white;
}

/* Split.js gutter styles */
.gutter {
  background-color: #eee;
  background-repeat: no-repeat;
  background-position: 50%;
}

body[data-theme="vs-dark"] .gutter,
body[data-theme="hc-black"] .gutter {
  background-color: #333;
}

.gutter.gutter-horizontal {
  cursor: col-resize;
  background-image: url("");
}

.gutter.gutter-vertical {
  cursor: row-resize;
  background-image: url("");
}

/* Dropdown styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  display: none;
  min-width: 160px;
  padding: 0.5rem 0;
  margin: 0.125rem 0 0;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

body[data-theme="vs-dark"] .dropdown-menu,
body[data-theme="hc-black"] .dropdown-menu {
  background-color: #252526;
  border-color: #333;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}

body[data-theme="vs-dark"] .dropdown-menu a,
body[data-theme="hc-black"] .dropdown-menu a {
  color: #eee;
}

.dropdown-menu a:hover {
  background-color: #f5f5f5;
}

body[data-theme="vs-dark"] .dropdown-menu a:hover,
body[data-theme="hc-black"] .dropdown-menu a:hover {
  background-color: #333;
}

/* Loading Spinner */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}

body[data-theme="vs-dark"] .loading-overlay,
body[data-theme="hc-black"] .loading-overlay {
  background-color: rgba(30, 30, 30, 0.8);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #4caf50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .controls {
    flex-wrap: wrap;
  }

  header {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .controls {
    width: 100%;
    justify-content: flex-start;
  }
}

/* 依赖管理面板样式 */
.dependency-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none;
  height: 200px;
  overflow: hidden;
  flex-direction: column;
}

body[data-theme="vs-dark"] .dependency-panel,
body[data-theme="hc-black"] .dependency-panel {
  background-color: #252526;
  border-top-color: #333;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.dependency-panel.show {
  display: flex;
}

.dependency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

body[data-theme="vs-dark"] .dependency-header,
body[data-theme="hc-black"] .dependency-header {
  border-bottom-color: #333;
}

.dependency-header h3 {
  margin: 0;
  font-size: 16px;
}

.dependency-content {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#dependency-input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

body[data-theme="vs-dark"] #dependency-input,
body[data-theme="hc-black"] #dependency-input {
  background-color: #333;
  color: #eee;
  border-color: #555;
}

#dependency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dependency-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background-color: #f0f0f0;
  border-radius: 4px;
  font-size: 14px;
}

body[data-theme="vs-dark"] .dependency-item,
body[data-theme="hc-black"] .dependency-item {
  background-color: #333;
}

.dependency-item .remove-btn {
  cursor: pointer;
  color: #ff5252;
  font-weight: bold;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .dependency-panel {
    height: 250px;
  }
}
